// import { documentTitle } from '@/config/index'
module.exports = {
  productionSourceMap: false,
  chainWebpack: config => {
    if (process.env.VUE_APP_MODE === 'prod') {
      config.output.filename('js/[chunkhash:8].js').chunkFilename('js/[chunkhash:8].js')
      config.plugin('extract-css').tap(args => {
        const cssFile = {
          filename: 'css/[contenthash:8].css',
          chunkFilename: 'css/[contenthash:8].css'
        }
        args[0] = cssFile
        return args
      })
    }
    config.plugin('html').tap(args => {
      args[0].title = '耕云设备健康云'
      return args
    })
  },
  configureWebpack: {
    externals: {
      vue: 'Vue',
      'vue-router': 'VueRouter',
      vuex: 'Vuex',
      'element-ui': 'ELEMENT',
      axios: 'axios',
      'vue-i18n': 'VueI18n',
      mockjs: 'Mock'
    }
  },
  css: {
    loaderOptions: {
      scss: {
        prependData: `@import "~@/assets/css/mixin.scss";`
      }
    }
  }
}
